﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WHC.Hotel.Entity;
using WHC.Hotel.BLL;
using WHC.OrderWater.Commons;


namespace WHC.Hotel.UI
{
    public partial class FrmChangeSuiteStatus : BaseForm
    {
        public TeaSuiteInfo RoomInfo = null;
        private TeaOrderInfo orderInfo = null;

        public FrmChangeSuiteStatus()
        {
            InitializeComponent();
        }

        private void FrmChangeSuiteStatus_Load(object sender, EventArgs e)
        {
            if (RoomInfo != null)
            {
                this.lblRoomNo.Text = RoomInfo.RoomNo;
                this.lblStatus.Text = RoomInfo.Status.ToString();

                orderInfo = BLLFactory<TeaOrder>.Instance.GetCurrentOrder(RoomInfo.RoomNo);
            }
        }

        #region 修改状态

        private void tsbAvailable_Click(object sender, EventArgs e)
        {
            if (orderInfo == null)
            {
                BLLFactory<TeaSuite>.Instance.SetRoomStatus(RoomInfo.RoomNo, TeaSuiteStatus.可供.ToString());
                this.DialogResult = DialogResult.OK;
                return;
            }
            else
            {
                MessageUtil.ShowTips("没有可寄托的主单，不能改变其状态");
                this.DialogResult = DialogResult.None;
            }
        }

        private void tsbBookin_Click(object sender, EventArgs e)
        {
            if (orderInfo == null)
            {
                BLLFactory<TeaSuite>.Instance.SetRoomStatus(RoomInfo.RoomNo, TeaSuiteStatus.预定.ToString());
                this.DialogResult = DialogResult.OK;
                return;
            }
            else
            {
                MessageUtil.ShowTips("没有可寄托的主单，不能改变其状态");
                this.DialogResult = DialogResult.None;
            }
        }

        private void tsbStop_Click(object sender, EventArgs e)
        {
            if (orderInfo == null)
            {
                BLLFactory<TeaSuite>.Instance.SetRoomStatus(RoomInfo.RoomNo, TeaSuiteStatus.停用.ToString());
                this.DialogResult = DialogResult.OK;
                return;
            }
            else
            {
                MessageUtil.ShowTips("没有可寄托的主单，不能改变其状态");
                this.DialogResult = DialogResult.None;
            }
        }

        private void tsbInUse_Click(object sender, EventArgs e)
        {
            if (orderInfo == null)
            {
                BLLFactory<TeaSuite>.Instance.SetRoomStatus(RoomInfo.RoomNo, TeaSuiteStatus.占用.ToString());
                this.DialogResult = DialogResult.OK;
                return;
            }
            else
            {
                MessageUtil.ShowTips("没有可寄托的主单，不能改变其状态");
                this.DialogResult = DialogResult.None;
            }
        }

        #endregion
    }
}
